/*
 * @Description: 数据模型
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2022-01-18 14:25:23
 * @LastEditTime: 2022-03-15 10:27:39
 * @FilePath: \cscec-pms-admin\src\views\construction\constructionCompleted\model.js
 */
import SelectSubCompany from '@/components/Select/SelectSubCompany'
import OrgTreeSelect from '@/components/OrgTreeSelect'
// 竣工收尾工作计划列表搜索选项
const searchOption = [
  {
    name: '所属单位',
    valueKey: 'searchQuery',
    type: OrgTreeSelect,
  },
  // {
  //   name: '项目名称',
  //   value: 'projectName',
  //   type: 'input'
  // },
  {
    name: '项目业态',
    value: 'projectFormat',
    type: 'select',
    data: []
  },
  // {
  //   name: '分公司',
  //   valueKey: 'branchComId',
  //   type: SelectSubCompany,
  // }
]
// 状态
const statusMap = {
  '0': { text: '待提交审批', status: 'warning', },
  '1': { text: '审批中', status: 'processing', },
  '2': { text: '运行中', status: 'success', },
  '3': { text: '审批不通过', status: 'error', },
  '4': { text: '完工', status: 'success', },
}
// 竣工收尾工作计划表头
const columns = [
  {
    title: '单位',
    fixed: 'left',
    width: 320,
    dataIndex: 'orgName',
    ellipsis: true,
    customRender: (value, row) => {
      if (row.tageCode === 'PD') {
        const text = row.projectVO?.projectName
        return text ? text : ''
      } else {
        return value
      }
    }
  },
  {
    title: '项目业态',
    dataIndex: 'projectFormats',
    width: 200,
    customRender: (value, row) => {
      const text = row.projectVO?.projectFormats
      return text ? text : ''
    }
  },
  {
    title: '节点按时完成率',
    width: 200,
    dataIndex: 'onTimeCompleteRate',
    scopedSlots: { customRender: 'rate' },
  },
  {
    title: '节点完成率',
    width: 200,
    dataIndex: 'completeRate',
    scopedSlots: { customRender: 'rate' },
  },
  {
    title: '合同竣工时间',
    width: 140,
    dataIndex: 'contractCompletionTime',
    customRender: (value, row) => {
      const text = row.projectVO?.contractCompletionTime
      return text ? text : ''
    }
  },
  {
    title: '变更后竣工时间',
    width: 140,
    dataIndex: 'afterChangeCompletionTime',
    customRender: (value, row) => {
      const text = row.projectVO?.afterChangeCompletionTime
      return text ? text : ''
    }
  },
  {
    title: '状态 ',
    width: 140,
    dataIndex: 'statusName',
    scopedSlots: { customRender: 'statusCode' },
  },
  {
    title: '操作',
    dataIndex: 'operation',
    fixed: 'right',
    width: 220,
    scopedSlots: { customRender: 'operation' },
  }
]
// 竣工收尾工作计划
const masterPlanList = [
  {
    label: '节点按时完成率',
    value: void 0,
    img: require('@/assets/masterPlan-1.png')
  },
  {
    label: '节点完成率',
    value: void 0,
    img: require('@/assets/masterPlan-2.png')
  },
  {
    label: '逾期一级节点数',
    value: void 0,
    img: require('@/assets/masterPlan-3.png')
  },
  {
    label: '逾期二级节点数',
    value: void 0,
    img: require('@/assets/masterPlan-4.png')
  },
  {
    label: '逾期三级节点数',
    value: void 0,
    img: require('@/assets/masterPlan-5.png')
  }
]
// 节点逾期情况
const overdueList = [
  {
    label: '一级节点逾期率',
    value: 0
  },
  {
    label: '二级节点逾期率',
    value: 0
  },
  {
    label: '三级节点逾期率',
    value: 0
  }
]
// 节点按时完成率情况
const accomplishList = [
  {
    label: '一级节点按时完成率',
    value: 0
  },
  {
    label: '二级节点按时完成率',
    value: 0
  },
  {
    label: '三级节点按时完成率',
    value: 0
  }
]
// 节点基本信息统计
const infoList = [
  {
    label: '按期完成节点数',
    value: 0
  },
  {
    label: '逾期完成节点数',
    value: 0
  },
  {
    label: '逾期未完成节点数',
    value: 0
  }
]
// 节点完成数量统计
const accomplishQuantityList = [
  {
    label: '一级节点已完成数',
    value: 0
  },
  {
    label: '二级节点已完成数',
    value: 0
  },
  {
    label: '三级节点已完成数',
    value: 0
  }
]
// 竣工收尾工作计划历史调整记录
const columns5 = [
  {
    title: '创建时间',
    width: 150,
    dataIndex: 'createTime'
  },
  {
    title: '申请人',
    width: 150,
    dataIndex: 'applicat'
  },
  {
    title: '调整一级节点个数',
    dataIndex: 'adjustFirstNodeNum'
  },
  {
    title: '调整二级节点个数',
    dataIndex: 'adjustSecondNodeNum'
  },
  {
    title: '调整三级节点个数',
    dataIndex: 'adjustThirdNodeNum'
  },
  {
    title: '附件',
    width: 300,
    dataIndex: 'fileInfoList'
  },
]
// 竣工收尾工作计划业务待办表单
const formOption = [
  {
    label: '能否按时竣工验收',
    keyName: 'onTimeCompleted',
    type: 'a-select',
    data: [
      {
        value: 'true',
        label: '能按时竣工验收'
      },
      {
        value: 'false',
        label: '不能按时竣工验收'
      }
    ],
    rules: [{ required: true, message: '请选择能否按时竣工验收', trigger: 'change' }]
  },
  {
    label: '不能按时竣工验收原因',
    keyName: 'reason',
    type: 'BaseTextarea',
    attrs: {
      maxLength: 300
    },
    rules: [{ required: true, message: '请输入不能按时竣工验收原因', trigger: 'change' }],
    span: 24
  },
  {
    label: '附件',
    keyName: 'fileList',
    slot: true,
    span: 24
  }
]
export {
  searchOption,
  statusMap,
  columns,
  masterPlanList,
  overdueList,
  accomplishList,
  infoList,
  accomplishQuantityList,
  columns5,
  formOption
}
